import { createRouter, createWebHistory } from 'vue-router'
// 用户组件
import loginVue from '@/views/user/login.vue';
import userIndexVue from '@/views/layout/userIndex.vue';
import cartVue from '@/views/user/cart.vue';
import userInfoVue from '@/views/user/userInfo.vue';
import userRePassWordVue from '@/views/user/userRePassWord.vue';
import addressVue from '@/views/user/userAddress.vue'
// 商品组件
import indexVue from '@/views/commodity/index.vue'
import layoutVue from '@/views/layout/index.vue'
import commodityDetailVue from '@/views/commodity/commodityDetail.vue'
import commodityListVue from '@/views/commodity/commodityList.vue'
// 订单组件
import confirmVue from '@/views/order/confirm.vue'
import orderShowVue from '@/views/order/orderShow.vue'
// AI组件
import AIVue from '@/views/AI/AI.vue';

const routes = [
        {path: '/', component: layoutVue, children: [
            {path: '', component: indexVue} ,
            {path: '/cart', component: cartVue},
            {path: "/confirm", component: confirmVue},
            {path: "/order", component: orderShowVue},
            {path: '/commodity/commodityList', component: commodityListVue },
            {path: '/commodity/Detail/:id', component: commodityDetailVue},
            {path: "/AI", component: AIVue}
        ]},
        {path: '/login', component: loginVue},
        {path:'/user', component: userIndexVue, children: [
            {path: "/user/info", component: userInfoVue},
            {path: "/user/resetPassWord", component: userRePassWordVue},
            {path: "/user/address", component: addressVue}
        ]},
        
        
]

// 路由关系
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

export default router